package com.example.jiakao;



import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class Fenlei_Adapter extends BaseAdapter{

	private Context context;
	private String menu[];
	
	public Fenlei_Adapter(Context context, String menu[]) {
		super();
		this.context = context;
		this.menu = menu;
	}

	@Override
	public int getCount() {

		return menu.length;
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return  arg0%menu.length;
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return arg0%menu.length;
	}

	@Override
	public View getView(int arg0, View arg1, ViewGroup arg2) {
		View view = LayoutInflater.from(context).inflate(R.layout.fenlei_list, null);
		TextView menuText = (TextView) view.findViewById(R.id.random_menu);
		menuText.setText(menu[arg0]);
		return view;
	}

}
